Add Method (Messages Collection)
The Add
method creates and returns a new Message object in the Messages collection.
Syntax
Set objMessage = objMsgColl.Add( [subject, text, type, importance]
)
Parameters
objMessage
On successful
return, represents the new Message object added to the collection.
objMsgColl
Required. The
Messages collection object.
subject
Optional.
String. The subject of the message. When this parameter is not supplied, the default
value is an empty string.
text
Optional.
String. The body text of the message. When this parameter is not supplied, the
default value is an empty string.
type
Optional.
String. The message class of the message, such as the default, IPM.Note.
importance
Optional.
Long. The importance of the message. The following values are defined:
|
Constant
|
Value |
Description
|
|
mapiLow |
0 |
Low
importance |
|
mapiNormal |
1 |
Normal
importance (default) |
|
mapiHigh |
2 |
High
importance |
Remarks
The method
parameters correspond to the Subject, Text, Type, and Importance properties of the Message
object.
You should
create new messages in the Outbox folder.
The user must
have permission to Add or Delete a Message object. Most users have this
permission in all .
The new Message object is saved in the MAPI
system when you call its Update method.
Example
This code
fragment adds a new message to a folder:
' from the sample function Util_ReplyToConversation
Set objNewMsg = objSession.Outbox.Messages.Add
' verify objNewMsg created successfully...then
supply properties
With objNewMsg
.Text =
"How about a slightly used Gemini?" ' new text
.Subject =
objOriginalMsg.Subject ' copy original properties
.ConversationTopic
= objOriginalMsg.ConversationTopic
' append
time stamp; compatible with Microsoft Exchange client
Set
objOneRecip = .Recipients.Add( _
Name:=objOriginalMsg.Recipients.Item(1).Name, _
Type:=mapiTo)
.Recipients.Resolve
.Update
.Send
showDialog:=False
End With